<?php 
	class ListAction extends Action{
		public function index(){
			import('Class.Category',APP_PATH);
			import('ORG.Util.Page');

			$cid=$_GET['id'];
			$cate=M('cate')->select();
			$arr=Category::getChild($cate,$cid);
			$pos=Category::getCate($cate,$cid);
			$this->pare=Category::getCate($cate,$pos['pid']);
			$this->pos=$pos;

			if($pos['name']=='关于我')
				 $this->about=M('blog')->field('content')->where(array('cid'=>$cid))->select();
			else if($pos['name']=='留言板')
				$this->display('leave');
			else{
				$count=M('blog')->where(array('cid'=>array('in',$arr),'del'=>0))->count();
				$page=new  Page($count,10);
				$limit=$page->firstRow.','.$page->listRows;
				$this->blogs=M('blog')->field('content',true)->where(array('cid'=>array('in',$arr),'del'=>0))->limit($limit)->select();
			$page->setConfig("theme","  %first%  %prePage%  %linkPage%  %nextPage% %end%");
				$this->page=$page->show();
				$this->nowPage=$page->nowPage;
				$this->Pages=$page->coolPages;
			}
			$this->display();
		}


		public function search(){
			$this->blogs=M('blog')->field('content',true)->where(array('title'=>array('like','%'.$_POST["s"].'%')))->select();
			$this->display('index');
		}
	}